﻿<Window x:Class="SampleProject.MVVMWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SampleProject"
        xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
        xmlns:tab="http://fabtab.codeplex.com"
    Title="MVVM Window" Height="600" Width="800">
    <Window.Resources>

        <Style TargetType="{x:Type tab:FabTabItem}">
            <Setter Property="Header" Value="{Binding Path=LabelText,diagnostics:PresentationTraceSources.TraceLevel=High}"/>
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Margin="0,0,4,0">
                            <TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis"/>

                        </StackPanel>

                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ShowCloseButton" Value="{Binding AllowClose}"/>
            <!--<Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <tab:EasingMarginAnimation Duration="0:0:0.7" From="500,0,0,0" To="0,0,0,0"
                                                         Storyboard.TargetProperty="Content.Margin"
                                                           Equation="BounceEaseIn"
                                                                     />

                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                </Trigger>
            </Style.Triggers>-->

        </Style>
        <DataTemplate DataType="{x:Type local:ModelObject}">
                <!--had to put in a few reasonable minwidths and heights in order to ensure that
                    the screenshot will look reasonable-->
            
                <StackPanel Margin="0,0,0,0" MinWidth="800" MinHeight="600" Background="LightGreen">
                    <Label Content="{Binding Path=Name}"/>
                    <TextBox Text="{Binding Path=Value}"/>
                    <Button Content="Bogus"/>
                </StackPanel>
            
        </DataTemplate>
        
        <LinearGradientBrush EndPoint="1,0" x:Key="mask">
            <LinearGradientBrush.Transform>
                <RotateTransform Angle="10"/>
            </LinearGradientBrush.Transform>
            <GradientStop Offset="0" Color="White"/>
            <GradientStop Offset="0.1" />
        </LinearGradientBrush>
        
    </Window.Resources>
    <DockPanel>
        <Button DockPanel.Dock="Right" Click="Button_Click" Content="Add Tab"/>
        <tab:FabTabControl x:Name="tabControl" ItemsSource="{Binding}" ShowDefaultTransitionAnimation="False"
                                  DockPanel.Dock="Left" ContentOpacityMask="{StaticResource mask}">
            <tab:FabTabControl.Triggers>
                <EventTrigger RoutedEvent="Selector.SelectionChanged">
                    <BeginStoryboard>
                        <Storyboard AutoReverse="False">
                            <tab:EasingDoubleAnimation Storyboard.TargetProperty="ContentOpacityMask.Transform.Angle"
                                                 Storyboard.TargetName="tabControl"
                                                     To="-90" From="10" Duration="0:0:0.7"
                                                       Equation="BackEaseInOut"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </tab:FabTabControl.Triggers>
        </tab:FabTabControl>
        
    </DockPanel>
</Window>
